<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

    	public function __construct()
	{
		parent::__construct();
                
		$this->load->library('lib_help');
		$this->load->Model('Users_model', '', TRUE);
                $this->load->Model('Tasks_model', '', TRUE);
	}
    
	public function index()
	{
            $data = '';
            
            //проверка авторизации
            if($this->lib_help->check_auth() || $this->Users_model->checkSocUserAuth())
                $this->data['user'] = $this->Users_model->getUser($_SESSION['user_id']);
                
            $this->load->view('header_view');
            
            $data['tasks_total_count'] = $this->Tasks_model->getTasksCount();
            $data['tasks'] = $this->Tasks_model->getLastTasks(TASKS_PER_PAGE);
            
            $data['html'] = $this->load->view('index_view', $data, true);
            $this->load->view('main_view', $data);
            $this->load->view('footer_view');
	}
}

/* End of file main.php */
/* Location: ./application/controllers/main.php */